/**
 * outsider.com.cn Inc.
 * Copyright (c) 2011-2022 All Rights Reserved.
 */
package com.yuanmeng.common.core.enums;

import com.yuanmeng.common.core.exception.ServiceException;

import lombok.Getter;

/**
 * @author outsider
 * @version Id: DisplayStyleEnum.java, v 0.1 2022/6/1 17:16 outsider Exp $$
 */
@Getter
public enum BusinessMethodEnum {
    ONLINE("ONLINE", "线上"),

    OFFLINE("OFFLINE", "线下"),

    VISIT("VISIT", "上门服务"),

    CURRENCY("CURRENCY", "通用");

    private String code;

    private String message;

    BusinessMethodEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static void validateBusinessMethod(String businessMethod) {
        int num = 0;
        for(BusinessMethodEnum ENUM : BusinessMethodEnum.values()) {
            if(ENUM.code.equals(businessMethod)) {
                num ++;
            }
        }
        if(num == 0) {
            throw new ServiceException("请求参数非法：businessMethod");
        }
    }
}